x = input('Введите скобку')
stack = []
f = 1

if x[0] in ')]}>':
    f = 0
for i in x:
    if i in "([{<":
        stack.append(i)
        last = stack[-1]
        if ((i == ")" and last == "(")
        or (i == "]" and last == "[")
        or (i == "}" and last == "{")
        or (i == ">" and last == "<")
        ):
            stack.pop()
        else:
            break

if len(stack) == 0 and f == 1:
    print(True)
else:
    print(False)
